/*
import {dynamicRouter1} from '../util/RouterData';
import Router from '../router/index';


export default function updateRoutes(router) {
  //发送一步请求
  var dynamicRouters2 = filterRouters(dynamicRouter1);
  dynamicRouters2.forEach((dynamicRouter) => {
    Router.addRoute(dynamicRouter)
  })
}


//过滤路由规则
export const filterRouters = (dynamicRouters) => {
  return dynamicRouters.filter((router)=>{
    if(router.component){
      const component1 = router.component;
      router.component = formatComponent(component1);
    }
    if(router.children && router.children.length){
      router.children=filterRouters(router.children);
    }
    return true;
  })

}

//对路由规则组件进行格式化
/!*export function formatComponent(routerName){
  return (resolve)=>require([`@/views/${routerName}.vue`],resolve)
}*!/

export function formatComponent(routerName) {
  return (resolve) => require([`@/views/${routerName}.vue`], resolve);
}
*/


import { dynamicRouters1 } from '../util/RouterData';
import Router from '../router/index';

export default function updateRoutes() {
  var dynamicRouters2 = filterRouters(dynamicRouters1);
  dynamicRouters2.forEach((dynamicRouter) => {
    Router.addRoute(dynamicRouter);
  });
}

export const filterRouters = (dynamicRouters) => {
  return dynamicRouters.filter((router) => {
    if (router.component) {
      const component1 = router.component;
      router.component = formatComponent(component1);
    }
    if (router.children && router.children.length) {
      router.children = filterRouters(router.children);
    }
    return true;
  });
};

export function formatComponent(routerName) {
  return (resolve) => require([`@/views/${routerName}.vue`], resolve);
}
